
local round2 =function(num, idp)
	return GLOBAL.tonumber(string.format("%." .. (idp or 0) .. "f", num))
end
--鼠标悬浮在物品上显示信息
AddClassPostConstruct("widgets/hoverer",function(self)
	local old_SetString = self.text.SetString
	self.text.SetString = function(text,str)
		  -- 获取鼠标下的世界实体
        local target = GLOBAL.TheInput:GetWorldEntityUnderMouse() 
        -- 如果存在目标实体
		if target and target.prefab then
            -- 如果目标实体是牛铃
            if target.prefab == "beef_bell" or target.prefab == "shadow_beef_bell" then
                print("beef_bell")
                if target.HasBeefalo then
                    beefalo = target:GetBeefalo()
                    str = "\n" .. beefalo.components.writeable:GetText() .."的牛铃"
                end
            end
		end
		return old_SetString(text,str)
	end
end)

